Class KeyRecord

java.lang.Object
com.netscape.cmscore.dbs.DBRecord
com.netscape.cmscore.dbs.KeyRecord
All Implemented Interfaces:
IAttrSet, IDBObj, Serializable

public class KeyRecord extends DBRecord
A class represents a Key record. It maintains the key life cycle as well as other information about an archived key. Namely, whether a key is inactive because of compromise.
Author:
thomask
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • set

      public void set(String name, Object object) throws EBaseException
      Sets an attribute.

      Specified by:
      set in interface IAttrSet
      Overrides:
      set in class DBRecord
      Parameters:
      name - the name of the attribute
      object - the attribute object.
      Throws:
      EBaseException - on attribute handling errors.
    • get

      public Object get(String name) throws EBaseException
      Retrieves an attribute.

      Specified by:
      get in interface IAttrSet
      Overrides:
      get in class DBRecord
      Parameters:
      name - the name of the attribute to return.
      Throws:
      EBaseException - on attribute handling errors.
    • delete

      public void delete(String name) throws EBaseException
      Deletes an attribute.

      Specified by:
      delete in interface IAttrSet
      Overrides:
      delete in class DBRecord
      Parameters:
      name - the name of the attribute to delete.
      Throws:
      EBaseException - on attribute handling errors.
    • getElements

      public Enumeration<String> getElements()
      Retrieves an enumeration of attributes.

      Specified by:
      getElements in interface IAttrSet
      Overrides:
      getElements in class DBRecord
      Returns:
      an enumeration of the attribute names.
    • getSerializableAttrNames

      public Enumeration<String> getSerializableAttrNames()
      Retrieves serializable attribute names.
      Specified by:
      getSerializableAttrNames in interface IDBObj
      Overrides:
      getSerializableAttrNames in class DBRecord
      Returns:
      a list of serializable attribute names
    • getSerialNumber

      public BigInteger getSerialNumber() throws EBaseException
      Retrieves serial number of the key record. Each key record is uniquely identified by serial number.
      Returns:
      serial number of this key record
      Throws:
      EBaseException - failed to retrieve key serial number
    • setSerialNumber

      public void setSerialNumber(BigInteger serialno) throws EBaseException
      Sets serial number.
      Throws:
      EBaseException
    • getState

      public KeyState getState() throws EBaseException
      Retrieves the key state. This gives key life cycle information.
      Returns:
      key state
      Throws:
      EBaseException - failed to retrieve state of the key
    • setState

      public void setState(KeyState state) throws EBaseException
      Sets key state.

      Throws:
      EBaseException
    • getArchivedBy

      public String getArchivedBy()
      Retrieves the uid of person who archived this record.
      Returns:
      archiver uid
    • getPrivateKeyData

      public byte[] getPrivateKeyData() throws EBaseException
      Retrieves key.

      Returns:
      archived key
      Throws:
      EBaseException
    • setPrivateKeyData

      public void setPrivateKeyData(byte[] keydata) throws EBaseException
      Sets key data.
      Throws:
      EBaseException
    • getKeySize

      public Integer getKeySize() throws EBaseException
      Retrieves the key size.
      Returns:
      key size
      Throws:
      EBaseException - failed to retrieve key size
    • getMetaInfo

      public MetaInfo getMetaInfo()
      Retrieves the meta info.
      Returns:
      meta info
    • setKeySize

      public void setKeySize(Integer keySize) throws EBaseException
      Sets key size.

      Throws:
      EBaseException
    • getOwnerName

      public String getOwnerName() throws EBaseException
      Retrieves owner name.
      Returns:
      key owner name
      Throws:
      EBaseException - failed to retrieve key owner name
    • setOwnerName

      public void setOwnerName(String name) throws EBaseException
      Sets owner name.

      Throws:
      EBaseException
    • getPublicKeyData

      public byte[] getPublicKeyData() throws EBaseException
      Retrieves the public key.
      Returns:
      public key data
      Throws:
      EBaseException - failed to retrieve public key data
    • setPublicKeyData

      public void setPublicKeyData(byte[] key) throws EBaseException
      Sets the public key.

      Throws:
      EBaseException
    • getDateOfRevocation

      public Date[] getDateOfRevocation() throws EBaseException
      Retrieves the date(s) of revocation.
      Returns:
      revocation history
      Throws:
      EBaseException - failed to retrieve revocation history
    • setDateOfRevocation

      public void setDateOfRevocation(Date[] dates) throws EBaseException
      Sets the date of revocation.

      Throws:
      EBaseException
    • getAlgorithm

      public String getAlgorithm()
      Retrieves algorithm of the key pair.
      Returns:
      key algorithm
    • getCreateTime

      public Date getCreateTime()
      Retrieves the creation time of this record.
      Returns:
      creation time
    • getModifyTime

      public Date getModifyTime()
      Retrieves the last modification time of this record.
      Returns:
      modification time
    • getClientId

      public String getClientId() throws EBaseException
      Retrieves the client ID of this record.
      Returns:
      client id
      Throws:
      EBaseException - failed to retrieve client id
    • getKeyStatus

      public String getKeyStatus() throws EBaseException
      Retrieves the key status of this record.
      Returns:
      key status
      Throws:
      EBaseException - failed to retrieve key status
    • getDataType

      public String getDataType() throws EBaseException
      Retrieves the key data type of this record.
      Returns:
      data type
      Throws:
      EBaseException - failed to retrieve data type
    • getRealm

      public String getRealm() throws EBaseException
      Retrieves authorization realm.
      Returns:
      authorization realm
      Throws:
      EBaseException - failed to retrieve authorization realm
    • setWrappingParams

      public void setWrappingParams(org.mozilla.jss.netscape.security.util.WrappingParams params, boolean doEncrypt) throws Exception
      Sets wrapping parameters for key record metadata. Backwards compatibility method - calls overloaded version with storageKeyAlg=null.
      Throws:
      Exception
    • setWrappingParams

      public void setWrappingParams(org.mozilla.jss.netscape.security.util.WrappingParams params, boolean doEncrypt, String storageKeyAlg) throws Exception
      Sets wrapping parameters for key record metadata. Stores all wrapping/encryption parameters that are present in the params object. For RSA/EC storage certs, the config typically populates both encryption and wrapping parameters. For ML-KEM storage certs, only wrapping parameters are relevant (ML-KEM does not support the allowEncDecrypt_archival encryption path). ML-KEM-specific handling: - Skips sessionKeyWrapAlgorithm (ML-KEM uses encapsulation, not RSA wrapping) - Skips sessionKeyKeyGenAlgorithm (shared secret is derived via KEM, not generated)
      Parameters:
      params - Wrapping parameters from storage unit
      doEncrypt - Whether encryption was used (vs wrapping) - stored in payloadEncrypted field
      storageKeyAlg - Storage cert public key algorithm (e.g., "RSA", "EC", "ML-KEM-1024")
      Throws:
      Exception
    • getWrappingParams

      public org.mozilla.jss.netscape.security.util.WrappingParams getWrappingParams(org.mozilla.jss.netscape.security.util.WrappingParams oldParams) throws Exception
      Throws:
      Exception
    • isEncrypted

      public Boolean isEncrypted() throws EBaseException
      Throws:
      EBaseException